<?php
$companyid=$session->read("companyid");
$user=$session->read('User');
$isflag= true;//$action->checkPermissions($user,$companyid);
//$economicid=$session->read("economicid");
$depcostid = $session->read("depcostid");
?>
<div class="right_side_operate_area">
	<div class="right_side_title left">
    	<h2>
    	<?php 
		$companyname=$session->read("companyname");
		//$companyyear=$session->read("economicyear");
		//$economicid=$session->read("economicid");
		echo $html->link($companyname,"/companys/showinfosummary/".$companyid)."&nbsp;"."&nbsp;".'研发费用投入清单';
		?>
    	</h2>
    	<div class='clear'></div>
    </div>		   
	   <?php 
	   //if($isflag){ 
			 echo '<div class="right item_add_btn">';
			 echo $html->link("返回", '/companys/showdepcost/'.$depcostid);
			 echo '</div>'; 
			 echo '<div class="right item_add_btn">';
			 echo $html->link("添加", 'editdeplist');
			 echo '</div>';
		    // }else{
				//echo '<div class="right enableaction">';
				//echo "<a>添加</a>";
				//echo '</div>';
			//}
		 ?>
	<div class="clear"></div>
</div>
<div class="right_side_scollbar">
	<div class="detail_info_panel">
		<div class="items_list">
			<table>
				<tr>
					<th>项目名称</th>
					<th>起始日期</th>
					<th>完成日期</th>
					<th>所处阶段</th>
					<th>预期投入(￥)</th>
					<th>项目投入(￥)</th>
					<th>累计投入(￥)</th>
					<th>是否备案</th>
					<th><?php __('Action'); ?></th>
					<th>&nbsp;</th>
				</tr>
			<?php 
				if(!empty($lists)){
					foreach ($lists as $list)
					{
						$id=$list["DevelopmentList"]["id"];
						echo "<tr class='per_list'>";
						$name=$list['DevelopmentList']['name'];
						echo "<td>".$html->link($str->sub_len($name,20),"/companys/showdeplist/".$id."/",array("title"=>$name),null)."</td>";
						$start_date = $list['DevelopmentList']['start_date'];
						if(!empty($start_date)){
							$start_date=date("Y-m-d",strtotime($start_date));
						}
						echo "<td>".$start_date."</td>";
						$finish_date=$list['DevelopmentList']['finish_date'];
						if(!empty($finish_date)){
							$finish_date=date("Y-m-d",strtotime($finish_date));
						}
						echo "<td>".$finish_date."</td>";	
						echo "<td>".$list['DevelopmentList']["stage"]."</td>";
						echo "<td>".$list['DevelopmentList']["ex_investment"]."</td>";
						echo "<td>".$list['DevelopmentList']["act_investment"]."</td>";
						echo "<td>".$list['DevelopmentList']["total_investment"]."</td>";
						$record = $list['DevelopmentList']["record"];
						echo "<td>".$str->getisflag($record)."</td>";	
//						echo "<td>";
//			                $attachments=$list['Attachment'];
//			                if($attachments){
//				                $dan="'";
////				                $second_ownerid=$form->value('Company.second_owner');
//				                foreach($attachments as $attachment) {
//									echo "<li>";
//									echo "<span>".$html->link($attachment["file_name"],'/projects/download/'.$attachment["id"],null)."</span>";
//									echo "<span class='source_upload_date'>".date("Y-m-d",strtotime($attachment["created"]))."</span>";
//									if($user['isadmin'] || $user['isgroupadmin'] || $second_ownerid==$user['id']){
//											echo '<span class="source_upload_delete"><a title="删除" onclick="delfile(this,'.$dan.$attachment["id"].$dan.',0)" href="javascript:void(0)"></a></span>';
//									}
//									echo "</li>";
//								}
//							}else{
//								echo "暂无文件";
//							}
//			            echo "</td>";
						echo "<td>";						
						if($isflag){				
							echo $html->link(__('Edit',true),"/companys/editdeplist/".$id);
							echo $html->link(__('Delete',true),"/companys/deldeplist/".$id,array("onclick"=>"return doaction(this)"));						
						}else{
							echo "<span class='enableaction'>编辑</span>";
							echo "<span class='enableaction'>删除</span>";
						}
						echo "</td>";
						echo "</tr>";
			        }
		        }
		    ?>
			</table>
		</div>
	</div>
</div>

<?php echo $this->element('actionconfirm',array("title"=>"删除提示","message"=>"你确定要删除吗？")) ?>
